// Xampler, a MIDI-driven sampler
// Copyright (C) 2006 Nick Thomas
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
// 02110-1301 USA.

#ifndef XAMPLER_MAIN_WINDOW_HPP
#define XAMPLER_MAIN_WINDOW_HPP

// The top-level widget.

#include "Instrument.hpp"
#include "InstrumentEditor.hpp"
#include "MenuBar.hpp"
#include "State.hpp"
#include <gtkmm/box.h>
#include <gtkmm/entry.h>
#include <gtkmm/label.h>
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/togglebutton.h>
#include <gtkmm/window.h>

namespace xampler
{
    const int SYNTH_MESSAGE_POLL_INTERVAL = 20;

    class MainWindow : public Gtk::Window
    {
    public:
        MainWindow();

    private:
        void on_about();
        bool synth_message_handler();

        void on_open();
        void on_revert();
        void on_save();
        void on_save_as();
        bool get_save_filename(Glib::ustring title,
                               Glib::ustring &filename,
                               Gtk::FileChooserAction action);
        void actually_save(Glib::ustring filename);
        void actually_load(Glib::ustring filename);

        Glib::ustring m_last_saved_filename;

        Gtk::VBox m_top_level_vbox;
        MenuBar m_menu_bar;
        InstrumentEditor m_instrument_editor;
    };
}

#endif
